<html>
	<head>
	<script src="js/jQuery.js"></script>
	<script src="js/hash.js"></script>
	<script type="text/javascript">
		var api_key = "0bcccfa21e04d9cbb01dfe498a8203e1";
  var secret = "9269b3937233ffaa37a0ab91e8739702";
  
  var parts = window.location.search.substr(1).split("&");
  var GET = {};
  for (var i = 0; i < parts.length; i++) {
      var temp = parts[i].split("=");
      GET[decodeURIComponent(temp[0])] = decodeURIComponent(temp[1]);
  }
	
  var signature = md5("api_key" + api_key +"methodauth.getSessiontoken" + GET['token'] + "9269b3937233ffaa37a0ab91e8739702");

  xmlhttp=new XMLHttpRequest();
	xmlhttp.onreadystatechange=function() {
	  if (xmlhttp.readyState==4)
	    {
	    xmlDoc = $.parseXML(xmlhttp.responseText);
	    $xml = $( xmlDoc );
	    key = $xml.find("key").text();

	    chrome.extension.sendRequest({action:"login", key: key}, function(response) {
			
			});
	    }
	  }
	xmlhttp.open("POST","http://ws.audioscrobbler.com/2.0/?method=auth.getSession&api_key=" + 
			api_key + "&token=" + GET['token'] + "&api_sig=" + signature,true);
	xmlhttp.send("token=" + GET['token'] + "&api_key=" + api_key + "&api_sig=" + signature);
	</script>
	</head>
	
	<body>
		Congrats! Your Last.FM account is now linked! You need to reload Music by Google before it will begin scrobbling, but you may close this tab at any time.
	</body>
</html>